From: Hauke Mehrtens Date: Thu, 1 Jan 2026 16:38:07 +0000 (+0100) Subject: kernel: pcs-mtk-lynxi: backport fix for in-band status capabilities X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=7390e63374a9e0bd62c2448f362479de269b841a;p=openwrt%2Fopenwrt.git kernel: pcs-mtk-lynxi: backport fix for in-band status capabilities This patch fixes a bug in a patch we backported. This patch was cherry picked from upstream Linux because it references a patch we backported in the fixes tag. Fixes: 813ecda1f387 ("generic: backport phylink patches for PCS/PHY caps OPs") Link: https://github.com/openwrt/openwrt/pull/21366 Signed-off-by: Hauke Mehrtens --- diff --git a/target/linux/generic/backport-6.12/603-v6.14-net-pcs-pcs-mtk-lynxi-correctly-report-in-band-statu.patch b/target/linux/generic/backport-6.12/603-v6.14-net-pcs-pcs-mtk-lynxi-correctly-report-in-band-statu.patch new file mode 100644 index 0000000000..d34bc8ed48 --- /dev/null +++ b/target/linux/generic/backport-6.12/603-v6.14-net-pcs-pcs-mtk-lynxi-correctly-report-in-band-statu.patch @@ -0,0 +1,33 @@ +From a003c38d9bbbacd26b2354795bddb8d25631b0b5 Mon Sep 17 00:00:00 2001 +From: Daniel Golle +Date: Thu, 2 Jan 2025 12:41:21 +0000 +Subject: net: pcs: pcs-mtk-lynxi: correctly report in-band status capabilities + +Neither does the LynxI PCS support QSGMII, nor is in-band-status supported +in 2500Base-X mode. Fix the pcs_inband_caps() method accordingly. + +Fixes: 520d29bdda86 ("net: pcs: pcs-mtk-lynxi: implement pcs_inband_caps() method") +Signed-off-by: Daniel Golle +Link: https://patch.msgid.link/Z3aJccb1vW14aukg@pidgin.makrotopia.org +Signed-off-by: Jakub Kicinski +--- + drivers/net/pcs/pcs-mtk-lynxi.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/pcs/pcs-mtk-lynxi.c ++++ b/drivers/net/pcs/pcs-mtk-lynxi.c +@@ -93,11 +93,12 @@ static unsigned int mtk_pcs_lynxi_inband + { + switch (interface) { + case PHY_INTERFACE_MODE_1000BASEX: +- case PHY_INTERFACE_MODE_2500BASEX: + case PHY_INTERFACE_MODE_SGMII: +- case PHY_INTERFACE_MODE_QSGMII: + return LINK_INBAND_DISABLE | LINK_INBAND_ENABLE; + ++ case PHY_INTERFACE_MODE_2500BASEX: ++ return LINK_INBAND_DISABLE; ++ + default: + return 0; + } diff --git a/target/linux/generic/hack-6.12/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch b/target/linux/generic/hack-6.12/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch index bf26a2f6ec..2073f40d89 100644 --- a/target/linux/generic/hack-6.12/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch +++ b/target/linux/generic/hack-6.12/750-net-pcs-mtk-lynxi-workaround-2500BaseX-no-an.patch @@ -13,7 +13,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/pcs/pcs-mtk-lynxi.c +++ b/drivers/net/pcs/pcs-mtk-lynxi.c -@@ -129,14 +129,23 @@ static void mtk_pcs_lynxi_get_state(stru +@@ -130,14 +130,23 @@ static void mtk_pcs_lynxi_get_state(stru struct phylink_link_state *state) { struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs); @@ -41,7 +41,7 @@ Signed-off-by: Daniel Golle } static void mtk_sgmii_reset(struct mtk_pcs_lynxi *mpcs) -@@ -157,7 +166,7 @@ static int mtk_pcs_lynxi_config(struct p +@@ -158,7 +167,7 @@ static int mtk_pcs_lynxi_config(struct p { struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs); bool mode_changed = false, changed; @@ -50,7 +50,7 @@ Signed-off-by: Daniel Golle int advertise, link_timer; advertise = phylink_mii_c22_pcs_encode_advertisement(interface, -@@ -180,9 +189,8 @@ static int mtk_pcs_lynxi_config(struct p +@@ -181,9 +190,8 @@ static int mtk_pcs_lynxi_config(struct p if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) { if (interface == PHY_INTERFACE_MODE_SGMII) sgm_mode |= SGMII_SPEED_DUPLEX_AN; diff --git a/target/linux/generic/pending-6.12/739-03-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch b/target/linux/generic/pending-6.12/739-03-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch index 0e4a63ec7f..4b16fd2956 100644 --- a/target/linux/generic/pending-6.12/739-03-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch +++ b/target/linux/generic/pending-6.12/739-03-net-pcs-pcs-mtk-lynxi-add-platform-driver-for-MT7988.patch @@ -79,7 +79,7 @@ Signed-off-by: Daniel Golle static struct mtk_pcs_lynxi *pcs_to_mtk_pcs_lynxi(struct phylink_pcs *pcs) { return container_of(pcs, struct mtk_pcs_lynxi, pcs); -@@ -117,6 +139,17 @@ static void mtk_pcs_lynxi_get_state(stru +@@ -118,6 +140,17 @@ static void mtk_pcs_lynxi_get_state(stru FIELD_GET(SGMII_LPA, adv)); } @@ -97,7 +97,7 @@ Signed-off-by: Daniel Golle static int mtk_pcs_lynxi_config(struct phylink_pcs *pcs, unsigned int neg_mode, phy_interface_t interface, const unsigned long *advertising, -@@ -162,6 +195,7 @@ static int mtk_pcs_lynxi_config(struct p +@@ -163,6 +196,7 @@ static int mtk_pcs_lynxi_config(struct p SGMII_PHYA_PWD); /* Reset SGMII PCS state */ @@ -105,7 +105,7 @@ Signed-off-by: Daniel Golle regmap_set_bits(mpcs->regmap, SGMSYS_RESERVED_0, SGMII_SW_RESET); -@@ -248,10 +282,29 @@ static void mtk_pcs_lynxi_link_up(struct +@@ -249,10 +283,29 @@ static void mtk_pcs_lynxi_link_up(struct } } @@ -135,7 +135,7 @@ Signed-off-by: Daniel Golle mpcs->interface = PHY_INTERFACE_MODE_NA; } -@@ -262,11 +315,12 @@ static const struct phylink_pcs_ops mtk_ +@@ -263,11 +316,12 @@ static const struct phylink_pcs_ops mtk_ .pcs_an_restart = mtk_pcs_lynxi_restart_an, .pcs_link_up = mtk_pcs_lynxi_link_up, .pcs_disable = mtk_pcs_lynxi_disable, @@ -151,7 +151,7 @@ Signed-off-by: Daniel Golle { struct mtk_pcs_lynxi *mpcs; u32 id, ver; -@@ -274,29 +328,33 @@ struct phylink_pcs *mtk_pcs_lynxi_create +@@ -275,29 +329,33 @@ struct phylink_pcs *mtk_pcs_lynxi_create ret = regmap_read(regmap, SGMSYS_PCS_DEVICE_ID, &id); if (ret < 0) @@ -192,7 +192,7 @@ Signed-off-by: Daniel Golle mpcs->ana_rgc3 = ana_rgc3; mpcs->regmap = regmap; -@@ -307,6 +365,13 @@ struct phylink_pcs *mtk_pcs_lynxi_create +@@ -308,6 +366,13 @@ struct phylink_pcs *mtk_pcs_lynxi_create mpcs->interface = PHY_INTERFACE_MODE_NA; return &mpcs->pcs; @@ -206,7 +206,7 @@ Signed-off-by: Daniel Golle } EXPORT_SYMBOL(mtk_pcs_lynxi_create); -@@ -319,5 +384,142 @@ void mtk_pcs_lynxi_destroy(struct phylin +@@ -320,5 +385,142 @@ void mtk_pcs_lynxi_destroy(struct phylin } EXPORT_SYMBOL(mtk_pcs_lynxi_destroy); diff --git a/target/linux/mediatek/patches-6.12/740-net-pcs-mtk_lynxi-add-mt7987-support.patch b/target/linux/mediatek/patches-6.12/740-net-pcs-mtk_lynxi-add-mt7987-support.patch index d4d09b64fd..d72b9fb7dc 100644 --- a/target/linux/mediatek/patches-6.12/740-net-pcs-mtk_lynxi-add-mt7987-support.patch +++ b/target/linux/mediatek/patches-6.12/740-net-pcs-mtk_lynxi-add-mt7987-support.patch @@ -10,7 +10,7 @@ Signed-off-by: Bo-Cun Chen --- a/drivers/net/pcs/pcs-mtk-lynxi.c +++ b/drivers/net/pcs/pcs-mtk-lynxi.c -@@ -413,9 +413,12 @@ static int mtk_pcs_lynxi_probe(struct pl +@@ -414,9 +414,12 @@ static int mtk_pcs_lynxi_probe(struct pl if (of_property_read_bool(np->parent, "mediatek,pnswap")) flags |= MTK_SGMII_FLAG_PN_SWAP; @@ -26,7 +26,7 @@ Signed-off-by: Bo-Cun Chen reset_control_deassert(mpcs->rstc); mpcs->sgmii_sel = devm_clk_get_enabled(dev, "sgmii_sel"); -@@ -462,6 +465,7 @@ static void mtk_pcs_lynxi_remove(struct +@@ -463,6 +466,7 @@ static void mtk_pcs_lynxi_remove(struct } static const struct of_device_id mtk_pcs_lynxi_of_match[] = { diff --git a/target/linux/mediatek/patches-6.12/741-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch b/target/linux/mediatek/patches-6.12/741-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch index eef6e361a9..fd0a587bb0 100644 --- a/target/linux/mediatek/patches-6.12/741-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch +++ b/target/linux/mediatek/patches-6.12/741-net-pcs-mtk-lynxi-add-phya-tx-rx-clock-path.patch @@ -28,7 +28,7 @@ Signed-off-by: Bo-Cun Chen /* Register to reset SGMII design */ #define SGMSYS_RESERVED_0 0x34 -@@ -166,7 +169,7 @@ static int mtk_pcs_lynxi_config(struct p +@@ -167,7 +170,7 @@ static int mtk_pcs_lynxi_config(struct p { struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs); bool mode_changed = false, changed; @@ -37,7 +37,7 @@ Signed-off-by: Bo-Cun Chen int advertise, link_timer; advertise = phylink_mii_c22_pcs_encode_advertisement(interface, -@@ -193,6 +196,12 @@ static int mtk_pcs_lynxi_config(struct p +@@ -194,6 +197,12 @@ static int mtk_pcs_lynxi_config(struct p bmcr = BMCR_ANENABLE; } @@ -50,7 +50,7 @@ Signed-off-by: Bo-Cun Chen if (mpcs->interface != interface) { link_timer = phylink_get_link_timer_ns(interface); if (link_timer < 0) -@@ -235,12 +244,14 @@ static int mtk_pcs_lynxi_config(struct p +@@ -236,12 +245,14 @@ static int mtk_pcs_lynxi_config(struct p /* Update the sgmsys mode register */ regmap_update_bits(mpcs->regmap, SGMSYS_SGMII_MODE, @@ -67,7 +67,7 @@ Signed-off-by: Bo-Cun Chen /* Release PHYA power down state * Only removing bit SGMII_PHYA_PWD isn't enough. -@@ -413,6 +424,9 @@ static int mtk_pcs_lynxi_probe(struct pl +@@ -414,6 +425,9 @@ static int mtk_pcs_lynxi_probe(struct pl if (of_property_read_bool(np->parent, "mediatek,pnswap")) flags |= MTK_SGMII_FLAG_PN_SWAP;